/**
 * This class contains unit tests for validating the behavior of Apex classes
 * and triggers.
 *
 * Unit tests are class methods that verify whether a particular piece
 * of code is working properly. Unit test methods take no arguments,
 * commit no data to the database, and are flagged with the testMethod
 * keyword in the method definition.
 *
 * All test methods in an organization are executed whenever Apex code is deployed
 * to a production organization to confirm correctness, ensure code
 * coverage, and prevent regressions. All Apex classes are
 * required to have at least 75% code coverage in order to be deployed
 * to a production organization. In addition, all triggers must have some code coverage.
 * 
 * The @isTest class annotation indicates this class only contains test
 * methods. Classes defined with the @isTest annotation do not count against
 * the organization size limit for all Apex scripts.
 *
 * See the Apex Language Reference for more information about Testing and Code Coverage.
 */
 
 /**
 *	Created by : Bob Ceuppens / ABSI 
 *  Creation Date : 20/01/2010
 *	Description : Test Coverage for trigger ContactAfterCreate
 */ 
 
@isTest
private class TEST_triggerContactAfterCreate {

   static testMethod void myUnitTest() {
		System.debug(' ################## ' + 'BEGIN TEST_triggerContactAfterCreate' + ' ################');
          	String myUserId = System.Userinfo.getUserId();
           	User myUser = [select Id from User where Id =: myUserId];
            System.runAs(myUser) {
        	TEST_triggerContactAfterCreate myTestClass = new TEST_triggerContactAfterCreate();
        	myTestClass.init();
        	myTestClass.createRecords();
        	myTestClass.doTests();
        }
        System.debug(' ################## ' + 'END TEST_triggerContactAfterCreate' + ' ################');
    }
    
	public void init() {
		
	}

	public void createRecords() {
		
				Account acc1 = new Account();
				acc1.Name = 'Aatest Coverage Sales Force Account ';
				acc1.BillingCity = 'Brussels';
				acc1.BillingCountry = 'Belgium';
				insert acc1;
						
			 Contact cont1 = new Contact();
			 cont1.LastName = 'Test Coverage' ;  
			 cont1.AccountId = acc1.Id ; 
			 insert cont1 ;
		
	}

	public void doTests() {
		String allChars = '@0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
		for (Integer i=0; i<allChars.length(); i++) {
			String myChar = allChars.substring(i,i+1);
			System.debug(' ################## ' + 'TEST_triggerContactAfterCreat_myChar = ' + myChar + ' ################');
			myChar = ContactMGT.Code(myChar);
			System.debug(' ################## ' + 'TEST_triggerContactAfterCreat_myChar_ASCII = ' + myChar + ' ################');
			if (myChar == 'a') {
				System.assertEquals(ContactMGT.Code(myChar), '97');
			}
			if (myChar == 'A') {
				System.assertEquals(ContactMGT.Code(myChar), '65');
			}
		}
		
	}
}